*** Settings ***
Library           Selenium2Library
Resource          OPTable.robot    # table操作
Resource          ../CommonVars/Locations/CommonLocators/LSelectSelect.robot    # 双击域定位信息
Resource          OpProposal/OpFloatButtonPart/Op 按钮点击后.robot

*** Keywords ***
Go SelectSelect
    [Arguments]    ${selectlocal}    ${SelectCode}    ${SelectName}    # 双击域定位 搜索code \ 搜索名称
    [Documentation]    1、双击 \ 弹出双击域
    ...    2、按照情况来搜索
    ...    3、获取搜索情况
    ...    \ \ \ \ \ 是否有查询结果
    ...    4、选择搜索情况
    ...    5、确定：
    ...    \ \ 1、单击选中项 \ \ 2、单击确定按钮
    ...
    ...    ${selectlocal} \ | ${SelectCode} \ | ${SelectName}
    sleep    1
    #双击 等待 双击失败
    Op 双击加载    ${selectlocal}
    sleep    2
    #填写code / name
    Clear Element Text    ${LSelectSelectCode}
    Clear Element Text    ${LSelectSelectCodeName}
    log    ${SelectName}
    Run Keyword If    '${SelectCode}' != 'NONE'    input text    ${LSelectSelectCode}    ${SelectCode}
    Run Keyword If    '${SelectName}' != 'NONE'    input text    ${LSelectSelectCodeName}    ${SelectName}
    #查询 \ 同时为空则查询全部
    Click Element    ${LSelectSelectQuery}
    # 检查查询按钮是不是在loading    #检查disabled=disabled
    sleep    2
    ${Iclass}=    Get Element Attribute    ${LSelectSelectQuery}    class
    FOR    ${i}    IN RANGE    0    9999
        log    ${Iclass}
        exit for loop if    'disabled' not in '${Iclass}'
        ${Iclass}=    Get Element Attribute    ${LSelectSelectQuery}    InnerText
    END
    Sleep    1    #查询结果    #${rows} =    GetTableRows    ${LSelectSelectResultRows}    #Run Keyword If    $rows >= 1    Click Element    ${LSelectSelectResultFirstRow}    #...    # ELSE    log    $rows is None and \ search have none Result    Return From Keyword
    Click Element    ${LSelectSelectResultFirstRow}

Go SelectSelect By InputText
    [Arguments]    ${locator}    ${companycode}
    [Documentation]    双击域方案一：
    ...    \ \ \ \ \ 填写业务归属机构双击域值，当业务归属机构名称值存在 则返回业务归属机构名称
    input text    ${locator}    ${companycode}
    ${companyCName}=    Get Text    ${LCompanyCName}
    [Return]    ${companyCName}    # 返回业务归属机构名称
